package com.xiaoran.RMQ_1.test2;

import com.rabbitmq.client.Channel;
import com.xiaoran.RMQ_1.utlis.RabbitMqUtils;
import javafx.beans.binding.When;

import java.util.Queue;
import java.util.Scanner;
import java.util.UUID;


public class Work_Producer {
    public static final  String QUEUE_NAME="hello";
    public static void main(String args[]) throws  Exception{
        Channel channel= RabbitMqUtils.getChannel();
        //创建队列
        channel.queueDeclare(QUEUE_NAME,false,false,false,null);
        //从控制台中输入消息
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNext()){
            String message=scanner.next();
            channel.basicPublish("",QUEUE_NAME,null,message.getBytes());
            System.out.println("发送完成："+message);
        }

    }
}
